test(harness): complete the auth mock in the definition list wiring test [SAP-3214] - #899
Conversation
…est [SAP-3214] The server now imports credentialsFilePath from @sapiom/mcp/auth for the credential store observer (4fd155b), which landed on main after #880 was rebased. The wiring test's mock did not export it, so the test failed on main while it passed on the PR's own CI. The mock now spreads the real module and only replaces the credential store and the browser flow, with credentialsFilePath pointing at a store that does not exist. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 22 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe test authentication mock now preserves real module exports, stubs credential and browser-auth behavior, and provides deterministic missing-credential and credential-path fixtures. ChangesAuthentication test mock
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This test-only change completes the authentication mock so credential observation remains isolated from user credentials. No runtime or release behavior is changed, and no merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit guards the auth-file door Comment |
Review — PR #899 (round 1)Test-only change to 1. The same landmine is left armed in the sibling test —
|
Apply the importOriginal spread to auth-mcp-wiring.test.ts as well, the only other test that boots startServer() behind a full @sapiom/mcp/auth mock. State in the enrichment test's header that its mock is partial and which exports are replaced, and use a plain /tmp literal for the missing credential store, matching the sibling test. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Review — PR #899 (round 2, delta since
|
…y [SAP-3214] A mocked credentialsFilePath export does not contain the real module: its internal calls resolve through os.homedir() directly. Redirect homedir to a temp dir instead (the mcp-config test idiom), drop the now-unneeded export override, and correct the comment that claimed otherwise. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
gwitwer
left a comment
There was a problem hiding this comment.
Approving. Test-only, and the partial mock plus the node:os home-dir redirect is the right shape: a future auth import in the server can no longer become a missing-export failure, and anything left real stays under a temp home that does not exist.
One thing to update in the body: main is no longer red. #812 (merged 23:16Z) fixed the same failure the direct way, by adding credentialsFilePath: vi.fn() to this mock and pointing it at a temp path. I checked the merge result of this branch against current main: the file ends up with your spread plus that explicit override plus the home redirect, which is coherent and slightly belt-and-braces. Worth a one-line note so the next reader knows why both are there. Both server wiring tests and the full suite are green on main and on this head.
Primary change type
Problem and motivation
mainis red since #880 merged:src/server/definition-list-enrichment.test.tsfails withNo "credentialsFilePath" export is defined on the "@sapiom/mcp/auth" mock. The server started importingcredentialsFilePathfor the credential store observer in 4fd155b, which landed onmainafter #880 was rebased, so the PR's own CI passed while the merge commit does not.Summary and scope
The test's
vi.mock("@sapiom/mcp/auth")factory now spreads the real module and only replaces the credential store and the browser flow, withcredentialsFilePathpointing at a store that does not exist (the observer sees ENOENT and stays quiet, nothing under~/.sapiomis watched or written). A future import in the server can no longer turn this fake into a missing-export failure. Test file only, no runtime change.Related work
Related issue or discussion: SAP-3214, follow-up to #880.
Validation
Tests and documentation
The change is the test itself. Documentation: N/A, test-only change.
Compatibility and release impact
Security
will follow the
Security Policy for
private reporting.
AI assistance
Claude Code (Claude Fable 5.1) diagnosed the failing main run, wrote the mock change and ran the tests listed above. Verified by reading the diff and the passing run against current main.
Checklist
CONTRIBUTING.md, and this contribution follows the direct-PR or issue-first policy.any N/A checks above.
Summary by CodeRabbit